<template>
  <div class="home">
    <search></search>

    <hot v-if="hotMovies" :hotList="hotMovies" :totalComingMovie="totalComingMovie"></hot>
    <a :href="ad.url">
      <img :src="ad.image" alt class="ad" />
    </a>
    <dayhot :hotPoints="hotPoints" v-if="hotPoints"></dayhot>
  </div>
</template>

<script>
import search from "./home/search.vue";
import hot from "./home/hot.vue";
import dayhot from "./home/dayHot.vue";
export default {
  components: {
    search,
    hot,
    dayhot
  },
  props: {},
  data() {
    return {
      hotMovies: "",
      ad: "",
      totalComingMovie: "",
      hotPoints: "",
      cityList: ""
    };
  },
  watch: {},
  computed: {},
  methods: {
    getAd() {
      this.$http.get("/api/ad").then(res => {
        console.log(res);
        this.ad = res.data.data.areaFirst;
      });
    },
    getHotList() {
      this.$http.get("/api/loccationMovies").then(res => {
        console.log(res);
        this.hotMovies = res.data.data.ms;
        this.totalComingMovie = res.data.data.totalComingMovie;
      });
    },
    getDayHot() {
      this.$http.get("/api/GetFirstPageAdvAndNews").then(res => {
        console.log(res);
        this.hotPoints = res.data.data.hotPoints;
      });
    }
  },
  created() {
    this.getHotList(); // 热播和即将上映
    this.getAd(); // 广告
    this.getDayHot(); // 今日热点和新闻
  },
  mounted() {}
};
</script>
<style lang="scss" scoped>
@import "~@/assets/css/common.scss";
.home {
  a {
    display: block;
    border-bottom: vw(16) solid #f6f6f6;
    font-size: 0;
    .ad {
      width: 100%;
    }
  }
}
</style>